<%@ page contentType="text/html;charset=UTF-8"%>
<!doctype html>
<html>
<head>
<title>用户查询</title>

<jsp:include flush="true" page="../include.jsp"></jsp:include>
		

</head>
<body>
<div id="mian-left">
	<div class="info" style="width: 200px">这是信息提示啊！！！！！！</div>
	<div class="success" style="width: 200px">这是信息提示啊！！！！！！</div>
	<div id="header">
		
		<div class="easyui-panel" title="查询条件" style="padding:10px;"
				data-options="iconCls:'icon-search',collapsible:true,fit:true">
			<label>登录名：<input id="loginName" type="text" size="20"/></label> <label>用户ID：<input id="userId" type="text" size="20"/> </label>
			<label>时间：<input class="easyui-datebox" data-options="formatter:formatDateBox"></input></label>
			<button class="Btn" id="search" type="button">查询</button>
		</div>
		
	</div>
	<div id="mainContent">
		<table id="dg" class="easyui-datagrid" title="用户信息" style="padding:10px"
				data-options="singleSelect:true,toolbar:toolbar,sortName:'userId',sortOrder:'asc',remoteSort:false,pageSize:20,fitColumns:true,rownumbers:true,singleSelect:true,pagination:true,url:'${home}/user.do'">
			<thead>
				<tr>
					<th data-options="field:'ck',checkbox:true"></th>
					<th data-options="field:'userId',width:80,resizable:true,sortable:true">用户ID</th>
					<th data-options="field:'loginName',width:100,resizable:true">登录名</th>
					<th data-options="field:'loginPass',width:215,resizable:true,align:'right'">密码</th>
					<th data-options="field:'userName',width:150,resizable:true,align:'right'">昵称</th>
					<th data-options="field:'dn',width:80,resizable:true">号码</th>
					<th data-options="field:'userType',width:100,resizable:true,align:'center',formatter:format">用户类型</th>
					<th data-options="field:'islocked',width:50,resizable:true,align:'center',formatter:format1">锁定</th>
					<th data-options="field:'lastlogintime',width:120,resizable:true,align:'center',formatter:formatDate,sortable:true">最后登录时间</th>
				</tr>
			</thead>
		</table>
	</div>
</div>
<div id="mian-right">

</div>

<script type="text/javascript">
/*
		$(function(){
			$('#dg').datagrid({
				url: '../datagrid/datagrid_data1.json',
				title: 'Context Menu on DataGrid',
				iconCls: 'icon-save',
				width: 700,
				height: 250,
				fitColumns: true,
				singleSelect: true,
				columns:[[
					{field:'itemid',title:'Item ID',width:80},
					{field:'productid',title:'Product ID',width:120},
					{field:'listprice',title:'List Price',width:80,align:'right'},
					{field:'unitcost',title:'Unit Cost',width:80,align:'right'},
					{field:'attr1',title:'Attribute',width:250},
					{field:'status',title:'Status',width:60,align:'center'}
				]],
				onHeaderContextMenu: function(e, field){
					e.preventDefault();
					if (!cmenu){
						createColumnMenu();
					}
					cmenu.menu('show', {
						left:e.pageX,
						top:e.pageY
					});
				}
			});
		});
*/
</script>

<script type="text/javascript">
$(function(){
	var pager = $('#dg').datagrid('getPager');	// get the pager of datagrid
	pager.pagination({
		buttons:[{
			iconCls:'icon-search',
			handler:function(){
				alert('search');
			}
		},{
			iconCls:'icon-add',
			handler:function(){
				alert('add');
			}
		},{
			iconCls:'icon-edit',
			handler:function(){
				alert('edit');
			}
		}]
	});	
	
	$("#search").bind("click", function(){
        var queryParams = {};
        var loginName = $("#loginName").val();
        var userId = $("#userId").val();
        if(loginName) queryParams.loginName = $("#loginName").val();
        if(userId) queryParams.userId = $("#userId").val();
        
        $('#dg').datagrid('options').queryParams=queryParams;        
        $("#dg").datagrid('reload');  
	});
});
var toolbar = [{
	text:'查看',
	iconCls:'icon-print',
	handler:function(){

	}
},'-',{
	text:'修改',
	iconCls:'icon-cut',
	handler:function(){

	}
},'-',{
	text:'删除',
	iconCls:'icon-cancel',
	handler:function(){
		alert('save');
	}
}];
</script>
<style type="text/css">
</style>
<script>
var dataItem={"userType":{"3":"地市移动人员","2":"省移动人员","10":"地市移动人员(亲情通)",
	"1":"系统人员","7":"老师","6":"教委人员","5":"二级代理人员","4":"一级代理人员",
	"9":"家长","8":"学生","11":"集团客户人员","12":"区县移动人员"},
	"islocked":{"0":"已锁定","1":"未锁定"}
	};

function format(val,row){
	return dataItem.userType[val];
}
function format1(val,row){
	return dataItem.islocked[val];
}
</script>
</body>
</html>